<include file="public/layout" />
<script type="text/javascript" src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>矿机订单</h3>
                <h5>矿机交易订单查询及管理</h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div id="explanation" class="explanation" style=" width: 99%; height: 100%;">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span title="收起提示" id="explanationZoom" style="display: block;"></span>
        </div>
        <ul>
            <li>查看操作可以查看订单详情, 商品详情等</li>

        </ul>
    </div>
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>订单列表</h3>
                <h5></h5>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
            <form class="navbar-form form-inline"  method="post" action="{:U('Admin/Financing.FinancingOrder/export_order')}"  name="search-form2" id="search-form2">

                <input type="hidden" name="user_id" value="{$Request.param.user_id}">
                <input type="hidden" name="order_ids" value="">
                <!--用于查看结算统计 包含了哪些订单-->
                <input type="hidden" value="{$_GET['order_statis_id']}" name="order_statis_id" />

                <div class="sDiv">
                    <div class="sDiv2">
                        <input type="text" size="30" id="add_time_begin" name="add_time_begin" value="" class="qsbox"  placeholder="下单开始时间">
                    </div>
                    <div class="sDiv2">
                        <input type="text" size="30" id="add_time_end" name="add_time_end" value="" class="qsbox"  placeholder="下单结束时间">
                    </div>
                    <div class="sDiv2">
                        <!-- <select name="pay_status" class="select sDiv3" style="margin-right:5px;margin-left:5px">
                                <option value="">订单转态</option>
                                <option value="0">未支付</option>
                                <option value="1">已完成</option>
                                <option value="2">已取消</option>
                        </select> -->
                    </div>
                    <!--<div class="sDiv2">-->
                    <!--<select name="pay_code" class="select sDiv3" style="margin-right:5px;margin-left:5px">-->
                    <!--<option value="">支付方式</option>-->
                    <!--<option value="user_gold">金支付</option>-->
                    <!--<option value="user_money">余额支付</option>-->
                    <!--<option value="gold_money">金+余额支付</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <!--<div class="sDiv2">-->
                    <!--<select name="shipping_status" class="select sDiv3" >-->
                    <!--<option value="">发货状态</option>-->
                    <!--<option value="0">未发货</option>-->
                    <!--<option value="1">已发货</option>-->
                    <!--<option value="2">部分发货</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <!--<div class="sDiv2">-->
                    <!--<select name="order_status" class="select sDiv3" >-->
                    <!--<option value="">订单状态</option>-->
                    <!--<volist name="order_status" id="v" key="k">-->
                    <!--<option value="{$k-1}">{$v}</option>-->
                    <!--</volist>-->
                    <!--</select>-->
                    <!--</div>-->
                    <div class="sDiv2">
                        <select  name="keytype" class="select">
                            <option value="account">用户账户</option>
                            <option value="nickname">用户昵称</option>
                            <option value="order_sn">订单编号</option>
                        </select>
                    </div>
                    <div class="sDiv2">
                        <input type="text" size="30" name="keywords" class="qsbox" placeholder="搜索相关数据...">
                    </div>
                    <div class="sDiv2">
                        <input type="button" onclick="ajax_get_table('search-form2',1)"  class="btn" value="搜索">
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
            <div class="hDivBox" id="ajax_return">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th axis="col0">
                            <div style="width: 24px;"><i class="ico-check"></i></div>
                        </th>
                        <th align="left" abbr="consignee" axis="col4" class="">
                            <div style="text-align: center; width: 50px;" class="">ID</div>
                        </th>
                        <th align="left" abbr="order_sn" axis="col3" class="">
                            <div style="text-align: center; width: 140px;" class="">订单号</div>
                        </th>
                        <th align="left" abbr="consignee" axis="col4" class="">
                            <div style="text-align: center; width: 120px;" class="">申诉人</div>
                        </th>
                        <th align="left" abbr="consignee" axis="col4" class="">
                            <div style="text-align: center; width: 120px;" class="">买方id</div>
                        </th>
                        <th align="left" abbr="consignee" axis="col4" class="">
                            <div style="text-align: center; width: 120px;" class="">买方id</div>
                        </th>
                        <th align="left" abbr="consignee" axis="col4" class="">
                            <div style="text-align: center; width: 200px;" class="">申诉内容</div>
                        </th>

                        <!-- <th align="center" abbr="article_time" axis="col6" class="">
                          <div style="text-align: center; width: 60px;" class="">应付金额</div>
                        </th> -->
                        <!-- <th align="center" abbr="article_time" axis="col6" class="">
                            <div style="text-align: center; width: 60px;" class="">订单类型</div>
                        </th> -->
                        <!-- <th align="center" abbr="article_time" axis="col6" class="">
                              <div style="text-align: center; width: 60px;" class="">订单状态</div>
                        </th> -->

                        <!--<th align="center" abbr="article_time" axis="col6" class="">-->
                        <!--<div style="text-align: center; width: 60px;" class="">配送方式</div>-->
                        <!--</th>-->
                        <th align="center" abbr="article_time" axis="col6" class="">
                            <div style="text-align: center; width: 120px;" class="">申诉时间</div>
                        </th>
                        <th align="left" axis="col1" class="handle">
                            <div style="text-align: left; width: 150px;">操作</div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="tDiv">
            <!--<div class="tDiv2">-->
            <!--<div class="fbutton">-->
            <!--<a href="javascript:exportReport()">-->
            <!--<div class="add" title="选定行数据导出excel文件,如果不选中行，将导出列表所有数据">-->
            <!--<span><i class="fa fa-plus"></i>导出数据</span>-->
            <!--</div>-->
            <!--</a>-->
            <!--</div>-->
            <!--<div class="fbutton">-->
            <!--<a href="/index.php?m=Admin&c=Order.Order&a=add_order">-->
            <!--<div class="add" title="添加订单">-->
            <!--<span><i class="fa fa-plus"></i>添加订单</span>-->
            <!--</div>-->
            <!--</a>-->
            <!--</div>-->
            <!--</div>-->
            <div style="clear:both"></div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">

            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <!--分页位置-->
    </div>
</div>
<script type="text/javascript">


    $(document).ready(function(){

        $('#add_time_begin').layDate();
        $('#add_time_end').layDate();

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });

        ajax_get_table('search-form2',1);

        $('.ico-check ' , '.hDivBox').click(function(){
            $('tr' ,'.hDivBox').toggleClass('trSelected' , function(index,currentclass){
                var hasClass = $(this).hasClass('trSelected');
                $('tr' , '#flexigrid').each(function(){
                    if(hasClass){
                        $(this).addClass('trSelected');
                    }else{
                        $(this).removeClass('trSelected');
                    }
                });
            });
        });

    });


    //ajax 抓取页面
    function ajax_get_table(tab,page){
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type : "POST",
            url:"/index.php/Admin/World.World/ajax_appeal_review/p/"+page,//+tab,
            data : $('#'+tab).serialize(),// 你的formid
            success: function(data){
                $("#flexigrid").html('');
                $("#flexigrid").append(data);

                // 表格行点击选中切换
                $('#flexigrid > table>tbody >tr').click(function(){
                    $(this).toggleClass('trSelected');
                });

            }
        });
    }

    // 点击排序
    function sort(field){
        $("input[name='order_by']").val(field);
        var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
        $("input[name='sort']").val(v);
        ajax_get_table('search-form2',cur_page);
    }

    function exportReport(){
        var selected_ids = '';
        $('.trSelected' , '#flexigrid').each(function(i){
            selected_ids += $(this).data('order-id')+',';
        });
        if(selected_ids != ''){
            $('input[name="order_ids"]').val(selected_ids.substring(0,selected_ids.length-1));
        }
        $('#search-form2').submit();
    }

    //批量操作提交
    function act_submit(obj) {

        var wst = obj.attr('type');
        var id = obj.attr('data-id');
        var remark = "审核通过";
        if(wst != 1 ){
            layer.prompt({title: '请填写备注', formType: 2}, function(text, index){
                layer.close(index);
                remark = text;
                audit(id,wst,remark);
            });
        }else{
            layer.confirm('确定审核？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                audit(id,wst,remark);
            }, function () {

            });
        }
    }

    function audit(id,wst,remark){
        $.ajax({
            type: "POST",
            url: "{:url('Admin/World.World/agent_auditor')}",
            data: {agent_id:id,status:wst,remark:remark},
            dataType: 'json',
            success: function (data) {
                if(data.status == 1){
                    layer.alert(data.msg, {
                        icon: 1,
                        closeBtn: 0
                    }, function(){
                        window.location.reload();
                    });
                }else{
                    layer.alert(data.msg, {icon: 2,time: 3000});
                }
            },
            error:function(){
                layer.alert('网络异常', {icon: 2,time: 3000});
            }
        });
    }
</script>
</body>
</html>